<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>编辑任务</title>
    <script type="text/javascript" src="/js/jquery.js"></script>
</head>
<body>

<div>
    <form action="" method="post">
        <div>积分方式: <input type="radio" name ="type" value ="1" >阅读量
            <input type="radio" name ="type" value = "2">报名 </div>
        <div><input type="point" id = "J_point" value = "" placeholder="每次浏览获得多少积分"></div>
        <div>
        <select name="class_id" id="J_class">
            <option value="1">促销</option>
            <option value="2">热卖</option>
        </select>
        </div>
        <div>标题
            <input type="text" name="title" id ="J_title" placeholder="请输入任务标题">
        </div>

        <div>任务规则
            <input type="text" name="rule" id ="J_rule" placeholder="请输入任务规则" />
        </div>

        <div>任务封面
            <input type="file" name ="pic1" id = "J_upload"  >
            <input type="hidden" name = "pic" id ="J_pic" value ="">
        </div>
        <div>开始时间 <input type="date" name="start_time" /></div>
        <div>结束时间 <input type="date" name ="end_time"></div>
        <div>
            <textarea name="content" id="J_content" cols="30" rows="10">

            </textarea>
        </div>
        <bottom id = "J_submit">提交</bottom>
    </form>
</div>

<script>
    $(function(){
       var id = "${id}";
       if(id != 0){
           getTaskDetail(id)
       }
    });


    function getTaskDetail(id){
        var id = "${uid}";
        var data = {id:id};
        var url = "/user/user_info";
        $.ajax({
            type: "POST",
            async: false,
            dataType: 'json',
            contentType: "application/json; charset=utf-8",
            data: JSON.stringify(data),
            url: url,
            success: function(res){
                if(res.code == 200){
                    var datas = res.data;
                    $("#J_name").append(datas.name);
                    $("#J_code").append(datas.code);
                    $("#J_phone").append(datas.phone);
                    $("#J_avatar").append("<img src='"+datas.avatar+"'>");
                    $("#J_role_name").append(datas.role_name);
                    $("#J_balance").append(datas.balance);
                    $("#J_points").append(datas.points);
                }else{
                    alert(res.msg);
                }
            },
            error: function(){

            },
            complete: function(){
            }
        });
    }
</script>
</body>
</html>
